<%-- 实体通用布局过滤条件布局jsp页面 --%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/views/common/taglibs.jsp" %>
<!DOCTYPE>
<html>
<head>
    <!-- 引入通用js、css文件(xiaogq) -->
    <meta name="decorator" content="bootstrap">
    <link rel="stylesheet" type="text/css" href="${ctx}/css/widget/multiselect/multiselect.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/common/operation/sys_operation.css"/>
</head>
<body>
<div class="button_list">
    <a href="javascript:;" tableCode="${entityId}" onclick="saveFiledSort(this);">
        <span class="span_button">
            <span><img src="${ctx}/image/common/operation/oper_SAVE.png"></span>
            <span name="buTitle">保存</span>
        </span>
    </a>
    <a href="javascript:;" onclick="javascript:parent.closeTab();">
        <span class="span_button">
            <span><img src="${ctx}/image/common/operation/oper_CANCEL.png"></span>
            <span name="buTitle">取消</span>
        </span>
    </a>
</div>
<div class="box">
    <div class="left" style="width: 240px; padding-left: 10px; line-height: 35px; background-color: rgb(92,188,228);">属性名</div>
    <div id="field_sort" class="box_l">
        <c:forEach items="${fields}" var="item" varStatus="status">
            <li><input type="checkbox" id="check${item.id}" fieldId="${item.id}" fieldName="${item.name}" class="checkbox"><label for="check${item.id}">${item.inchinese}</label></li>
        </c:forEach>
    </div>
    <div class="box_m">
        <a href="javascript:" id="alltop">首个</a>
        <a href="javascript:" id="top"><span class="glyphicon glyphicon-chevron-up"></span></a>
        <a href="javascript:" id="bottom"><span class="glyphicon glyphicon-chevron-down"></span></a>
        <a href="javascript:" id="allbottom">最后</a>
    </div>
</div>
<script type="text/javascript" src="${ctx}/js/widget/multiselect/multiselect.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $(".box").orso({
            boxl:".box_l",//左边大盒子
            boxr:".box_r",//右边大盒子
            boxlrX:"li",//移动小盒子
            boxon:"choose",//点击添加属性
            checkbox:".checkbox",//复选框（新添加）
            idclass:true,//添加的属性是否为class//true=class; false=id;
            leftTop:"#top",//单个向上移动按钮
            leftBottom:"#bottom",//单个向下移动按钮
            leftFirstTop:"#alltop",//移动第一个按钮
            leftLastBottom:"#allbottom"//移动最后一个按钮
        });
    });

    //布局、过滤条件布局保存方法(xiaogq)
    function saveFiledSort(node) {
        var idstr = "";
        $("#field_sort li").find("input").each(function(index,node) {
            idstr += $(node).attr("fieldId")+"_"+(index+1) + ",";
        });
        if (idstr.length > 0) {
            idstr = idstr.substring(0, idstr.length - 1);
        }
        $.ajax({
            type: "GET",
            url: "${ctx}" +"/"+Constants.fieldSortUpdateUrl+"?sortIds="+idstr,
            dataType: "json",
            success: function(data) {
                var results = data.results;
                if(results == "sucess"){
                    parent.closeTab(1);
                }else{
                    alert("字段排序保存异常!");
                }
            },
            error: function() {
                alert("系统异常");
            }
        });
    }
</script>
</body>
</html>
